-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix][broker] Fix NPE after publishing a tombstone to the service unit channel #22859
Merged
BewareMyPower
merged 2 commits into
apache:master
from
BewareMyPower:bewaremypower/extensible-lb-npe
Jun 7, 2024
Merged
[fix][broker] Fix NPE after publishing a tombstone to the service unit channel #22859
BewareMyPower
merged 2 commits into
apache:master
from
BewareMyPower:bewaremypower/extensible-lb-npe
Jun 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t channel ### Motivation NPE will happen in `UnloadManager#handleEvent` after apache#22743. It's because the `Init` state is always associated with a null `ServiceUnitStateData`. ``` java.lang.NullPointerException: Cannot invoke "org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateData.force()" because "data" is null at org.apache.pulsar.broker.loadbalance.extensions.manager.UnloadManager.handleEvent(UnloadManager.java:204) ~[classes/:?] at org.apache.pulsar.broker.loadbalance.extensions.channel.StateChangeListeners.lambda$notify$3(StateChangeListeners.java:74) ~[classes/:?] at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:807) ~[?:?] at org.apache.pulsar.broker.loadbalance.extensions.channel.StateChangeListeners.notify(StateChangeListeners.java:72) ~[classes/:?] at org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateChannelImpl.handleInitEvent(ServiceUnitStateChannelImpl.java:902) ~[classes/:?] at org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateChannelImpl.handle(ServiceUnitStateChannelImpl.java:715) ~[classes/:?] ``` ### Modifications In `UnloadManager#handleEvent`, assume `data` is null and call `complete` directly. Fix `UnloadManagerTest`, which passes a non-null `ServiceUnitStateData` and `Init` to `handleEvent`.
BewareMyPower
requested review from
lhotari,
Technoboy-,
codelipenghui,
RobertIndie,
Demogorgon314 and
heesung-sn
June 6, 2024 09:37
dao-jun
approved these changes
Jun 6, 2024
heesung-sn
approved these changes
Jun 6, 2024
Thank you for catching this. |
@BewareMyPower
|
The checkstyle issue is fixed now. |
Demogorgon314
approved these changes
Jun 7, 2024
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08) (cherry picked from commit 6eac7e5)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 26, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08) (cherry picked from commit 6eac7e5)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Jun 27, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08) (cherry picked from commit 6eac7e5)
nikhil-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jun 27, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08) (cherry picked from commit 6eac7e5) (cherry picked from commit 9ffbffc)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jul 1, 2024
…t channel (apache#22859) (cherry picked from commit 9326a08) (cherry picked from commit 6eac7e5) (cherry picked from commit 9ffbffc)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-3.0
cherry-picked/branch-3.2
cherry-picked/branch-3.3
doc-not-needed
Your PR changes do not impact docs
release/3.0.6
release/3.2.4
release/3.3.1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
NPE will happen in
UnloadManager#handleEvent
after #22743. It's because theInit
state is always associated with a nullServiceUnitStateData
.Modifications
In
UnloadManager#handleEvent
, assumedata
is null and callcomplete
directly. FixUnloadManagerTest
, which passes a non-nullServiceUnitStateData
andInit
tohandleEvent
.Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: